**********************
* Appendix
**********************
* loading pixel data
import delimited "vcf_data_complete.csv", delimiter(",") clear

keep if year>=1995
keep if year<=2017
gen t = year-1995

local packs reghdfe estout
foreach pack of local packs{
	
	display( "`pack'" )
	capture which `pack'
	if _rc == 111{
		net install `pack', replace
	}

	if _rc != 111{
		display( "`pack' installed" )
	}
}


* running regressions - appendix
est clear
forvalues i = 30(10)50 {
	foreach sector in mining {		
		eststo: reghdfe con_`sector'`i'  c.sch#c.d if forest_cover==1, absorb(cellid styear i.cellid#c.t) cluster(blk)
			sum con_`sector'`i' if sch == 0 & forest_cover==1
			estadd scalar nschmean = `r(mean)'


			preserve 
				keep if forest_cover==1
				keep cellid
				duplicates drop
				count
				local aux `r(N)'
			restore
			estadd local fe_cellid `aux'

			local aux "VCF"
			estadd local dataset `aux'
			local aux "1995-2017"
			estadd local timespan `aux'
			estadd local fe `'
			local aux "$\\checkmark$"
			estadd local pixel `aux'
			estadd local styear `aux'
			estadd local timetrend `'
			estadd local tpix `aux'
			local aux "198"
			estadd local styear2 `aux'
			local aux "Block"
			estadd local clust `aux'
			sum con_`sector'`i' if sch == 1 & forest_cover==1
			estadd scalar schmean = `r(mean)'
		
		}
	}	

esttab est1 est2 est3 using "appendix_tableA8.tex", ///
replace cells(b (fmt(%9.4f)) se(par fmt(%9.4f))) style(tex) ///
stats(nschmean schmean dataset timespan ///
	fe pixel styear ///
	timetrend tpix ///
	fit_stat fe_cellid styear2 N clust r2, layout(@ @ @ @ @ @ @ @ @ @ @ @ @ @ @) ///
label("\midrule Mean Pre-Y (Non-Sch)" "Mean Pre-Y (Sched)" "Dataset" "Timespan" ///
	"\midrule \emph{Fixed-effects}" "Pixel" "State $\times$ Year" ///
	"\midrule \emph{Time Trends}" "t (Pixel)" ///
	"\midrule \emph{Fit statistics}" "\# Pixel" "\# State $\times$ Year" "\# Observations" "Standard-Errors" "R^2"  ) ///
fmt(%9.4f %9.4f %9.0f %9.4f %9.4f %9.4f %9.4f %9.4f %9.4f %9.4f %9.0f %9.0f %9.0f %9.3f)) ///
starlevels(* .1 ** .05 *** .01) ///
keep(c.sch#c.d) order() ///
varlabels(c.sch#c.d "PESA X Scheduled") ///
collabels(none) /// No column names within model
delim("&")  /// Type of column delimiter 
noobs /// Do not show number of observation used in model
nomtitle ///
label ///
width(1.5\hsize) ///
nogaps /// No gaps between rows
booktabs /// Style
nonote /// No notes
mgroups("30km" "40km" "50km", pattern( 1 1 1 ) ) ///
prehead( "\begin{table} \small \centering \protect \captionsetup{justification=centering} \caption{\label{tab:table5} The Impact of Increased Representation on Mining Conflict Onset (Robustness) }" "\noindent \scalebox{1}{ \begin{threeparttable}" "\begin{tabular}{lccc}" \toprule ) ///
posthead(\hline) prefoot("")  ///
postfoot(\hline \hline \end{tabular} ///
		\begin{tablenotes} ///
		\begin{footnotesize} ///
		"\emph{Notes:} Standard errors are clustered at the block level and reported in parentheses. Conflict data is from \texttt{https://landconflictwatch.org/}. Conflict onset is assigned to all pixels within the indicated radius in each panel." ///
		\end{footnotesize} ///
		"\end{tablenotes} \end{threeparttable} } \end{table}")



